
import requests
from app.web.casesuit.test_get_token import  GetToken

from app.web.comm.xiancheng import  XianCheng

from app.web.casesuit.get_token import GetToken
# base_url="https://shanghu-backend-dev.wetax.com.cn"
from app.web.conf.config import  *

# print(basedir)
class Project():
    # def __init__(self,tax_code,password):
    #     self.tax_code=tax_code
    #     self.password=password
    #     global token_pc
    #     token_pc=GetToken().login_token(tax_code,password)
    #     print(token_pc)

    # def add_store(self,tax_code="GAPENE7ETXN3LED",password="zxz123456"):#添加商品编码,住宿服务
        # token_pc = GetToken().token_pc(tax_code,password)

    def add_project(self,token_pc):  # 添加门店
        url = base_url_cloud + '/v3/client-project/create?token=%s'%token_pc
        #餐饮
        request_data={
                "is_default":1,#是否默认
                "special_invoice_kind":"",
                "firm_goods_name":"餐饮服务",
                "firm_goods_no":"3070401000000000000",
                "name":"餐饮服务1接口新增",
                "tax_code":"3070401000000000000",
                "tax_rate":"6%",
                "vat_special_manager":"",
                "description":"接口新增"
            }
        #住宿
        request_data1={
            "is_default":0,
            "special_invoice_kind":"",
            "firm_goods_name":"住宿服务",
            "firm_goods_no":"3070402000000000000",
            "name":"住宿服务",
            "tax_code":"3070402000000000000",
            "tax_rate":"6%",
            "vat_special_manager":""
        }

        res=requests.post(url=url,json=request_data,verify=False)
        print("请求地址：%s"%url)
        print(res.text)
        #write_file('/Public/ClientMsg',response.json()['data'])

    def add_equipment(self,token_pc):  # 添加门店
        url = base_url_cloud + '/v3/equipment/create?token=%s'%token_pc

        request_data={
            "tax_disk_type":2,#百旺
            "tax_num":"112222333345",
            "tax_machine":"",
            "bank_name":"中国银行",
            "bank_account":"6767767777777",
            "phone":"15677778888",
            "address":"大冲商务中心",
            "invoice_types":[0]#电子发票
        }

        res=requests.post(url=url,json=request_data,verify=False)
        print("请求地址：%s"%url)
        print(res.text)

if __name__=="__main__":

    P=Project()
    tax_code="GAPEN5A1EADACRC"
    password="zxz123456"
    token_pc = GetToken().login_token(tax_code, password)
    # P.add_project()
    # P.add_equipment(token_pc)
    P.add_project(token_pc)
